
organization in ThisBuild := "bi Group"

// the Scala version that will be used for cross-compiled libraries
scalaVersion in ThisBuild := "2.11.8"

ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }

val playJsonDerivedCodecs = "org.julienrf" %% "play-json-derived-codecs" % "3.3"
val macwire = "com.softwaremill.macwire" %% "macros" % "2.2.5" % "provided"
val scalaTest = "org.scalatest" %% "scalatest" % "3.2.0-SNAP1" % "test"

def project(id: String) = Project(id, base = file(id))
  .settings(javacOptions in compile ++= Seq("-encoding", "UTF-8", "-source", "1.8", "-target", "1.8", "-Xlint:unchecked", "-Xlint:deprecation"))
  .settings(libraryDependencies ++= Seq(scalaTest))

lazy val utils = project("biBACK-utils")
  .settings(
    version := "1.0-SNAPSHOT",
    libraryDependencies ++= Seq(
      lagomScaladslApi,
      lagomScaladslPersistenceCassandra,
      playJsonDerivedCodecs
    )
  )

lazy val utilsImpl = project("biBACK-utils-impl")
  .enablePlugins(LagomScala)
  .settings(
    version := "1.0-SNAPSHOT",
    libraryDependencies ++= Seq(
      lagomScaladslPersistenceCassandra,
      lagomScaladslServer,
      lagomScaladslTestKit,
      macwire
    )
  ).dependsOn(utils)

lazy val acct = project("biBACK-acct")
  .settings(
    version := "1.0-SNAPSHOT",
    libraryDependencies += lagomScaladslApi
  ).dependsOn(utils, cif)

lazy val acctImpl = project("biBACK-acct-impl")
  .enablePlugins(LagomScala)
  .settings(
    version := "1.0-SNAPSHOT",
    libraryDependencies ++= Seq(
      lagomScaladslPersistenceCassandra,
      lagomScaladslServer,
      lagomScaladslTestKit,
      macwire
    )
  ).dependsOn(utils, acct)

lazy val cif = project("biBACK-cif")
  .settings(
    version := "1.0-SNAPSHOT",
    libraryDependencies += lagomScaladslApi
  ).dependsOn(utils)

lazy val cifImpl = project("biBACK-cif-impl")
  .enablePlugins(LagomScala)
  .settings(
    version := "1.0-SNAPSHOT",
    libraryDependencies ++= Seq(
      lagomScaladslPersistenceCassandra,
      lagomScaladslServer,
      lagomScaladslTestKit,
      macwire
    )
  ).dependsOn(utils, cif)

lagomCassandraEnabled in ThisBuild := true
lagomCassandraCleanOnStart in ThisBuild := false
lagomKafkaEnabled in ThisBuild := false
